#include "kshapesettingfactory.h"
#include "kdrawsettingpanelwidget.h"

class KLineSettingStrategy : public KShapeSettingStrategy
{
public:
    void applyTo(KDrawSettingPanelWidget* panel) override
	{
        panel->getLblFillColor()->setVisible(false);
        panel->getBtnFillColor()->setVisible(false);
        panel->getBtnFillColor()->setEnabled(false);
        panel->getBtnFillColor()->setFlat(true);
    }
};

class KRectSettingStrategy : public KShapeSettingStrategy
{
public:
    void applyTo(KDrawSettingPanelWidget* panel) override
	{
        panel->getLblFillColor()->setVisible(true);
        panel->getBtnFillColor()->setVisible(true);
        panel->getBtnFillColor()->setEnabled(true);
        panel->getBtnFillColor()->setFlat(false);
    }
};

class KTextSettingStrategy : public KShapeSettingStrategy
{
public:
    void applyTo(KDrawSettingPanelWidget* panel) override
	{
    }
};

std::unique_ptr<KShapeSettingStrategy> KShapeSettingFactory::create(KShapeType shapeType)
{
    switch (shapeType)
	{
    case KShapeType::LineShapeType:
    case KShapeType::FreeHandShapeType:
        return std::make_unique<KLineSettingStrategy>();
    case KShapeType::RectShapeType:
    case KShapeType::EllipseShapeType:
    case KShapeType::StarShapeType:
    case KShapeType::CloudShapeType:
    case KShapeType::HeartShapeType:
    case KShapeType::HexagonShapeType:
    case KShapeType::PentagonShapeType:
    case KShapeType::RhombusShapeType:
        return std::make_unique<KRectSettingStrategy>();
    case KShapeType::TextShapeType:
        return std::make_unique<KTextSettingStrategy>();
    default:
        return nullptr;
    }
}